#include <iostream>
#include <vector>
int main() {
    std::vector<int> vec = {1, 2, 3, 3, 3, 4, 5};
    for (auto it = vec.begin(); it != vec.end();) {
        if (*it == 3) {
            it = vec.erase(it);
        } else {
            ++it;
        }
    }
    for (int i = 0; i < vec.size(); i++) {
        std::cout << vec[i] << std::endl;
    }

    return 0;
}